<template>
  <div>
    <div class="msg-list" v-if="messages.lenght > 0">
      <div class="msg-item" v-for="(message, index) of messages" :key="index">
        <a class="msg-item-avatar">
          <i class="msg-item-avatar-item el-icon-bell"></i>
        </a>
        <div class="msg-item-content">
          <div class="msg-item-header">
            <span class="msg-item-nickname">{{ message.topicContent }}</span>
          </div>
          <div class="msg-item-body">
            <div>
              {{ message.content }}
            </div>
          </div>
          <div class="msg-item-footer">
            <div class="btn-wrap">
              <span class="time">{{ message.createTime }}</span>
              <!-- <span class="time">2021-11-02 11:07:57</span> -->
            </div>
          </div>
        </div>
      </div>
    </div>
    <div v-if="messages.length == 0 ">
      <div class="nomessge">
          暂无新消息
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Notice",
  props: {
    messages: {
      type: Array,
      default() {
        return [];
      },
    },
  },
  data() {
    return {};
  },
};
</script>

<style scoped="scoped">
.nomessge{
  border: 1px solid #eee;
  min-height: 280px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.msg-item {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: stretch;
  -webkit-align-items: stretch;
  -ms-flex-align: stretch;
  align-items: stretch;
  padding: 24px 0;
  font-size: 14px;
  line-height: 20px;
  box-shadow: inset 0 -1px 0 #e8e8e8;
  min-width: 0;
  -webkit-box-flex: 1;
  -webkit-flex: 1 0 -webkit-calc(100% - 24 px);
  -ms-flex: 1 0 calc(100% - 24px);
  flex: 1 0 calc(100% - 24px);
  margin: 0 12px;
}

.msg-item-avatar {
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 auto;
  -ms-flex: 0 0 auto;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-right: 16px;
  position: relative;
  display: block;
}

.msg-item-content {
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 0;
  -ms-flex: 1 1 0px;
  flex: 1 1 0;
  min-width: 0;
}

.msg-item-header {
  margin-bottom: 8px;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  white-space: nowrap;
}

.msg-item-nickname {
  text-overflow: ellipsis;
  overflow-x: hidden;
  -webkit-flex-shrink: 1;
  -ms-flex-negative: 1;
  flex-shrink: 1;
  margin-right: 8px;
}

.msg-item-body {
  font-size: 16px;
  line-height: 24px;
  margin-bottom: 12px;
  word-break: break-all;
}

.btn-wrap {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  white-space: nowrap;
}

.msg-item-footer {
  margin-top: 12px;
}

.time {
  overflow-x: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  margin-right: 16px;
  color: #666;
  -webkit-box-flex: 1;
  -webkit-flex: 1 0 0;
  -ms-flex: 1 0 0px;
  flex: 1 0 0;
}

.msg-item-avatar-item {
  width: 100%;
  height: 100%;
  border: 1px solid #e8e8e8;
  border-radius: 50%;
  position: absolute;
  font-size: 20px;
}
</style>
